package com.cedric.yixianpai.game.cards.Sects.swordCards.e_HuaShen;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class JianYiJiDang extends SwordCard {
    private final int amplitude;//增幅百分比

    /**
     * title:剑意激荡
     * effect:SE-1 自身现有剑意增加80%/110%/140%
     */
    public JianYiJiDang(@Value("1") int lvl) {
        super("剑意激荡");
        this.setLevel(lvl);
        this.setPeriod(Period.HUASHEN);
        this.setDescription("灵气-1 自身现有剑意增加80%/110%/140%");

        this.setSpiritNeed(1);
        if (1 == lvl) {
            this.amplitude = 80;
        } else if (2 == lvl) {
            this.amplitude = 110;
        } else if (3 == lvl) {
            this.amplitude = 140;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if (Sta1.spiritEnough(this.getSpiritNeed())) {
            int currSI = Sta1.getPlayerBuff().getSwordIntent();
            Sta1.getPlayerBuff().setSwordIntent(currSI + currSI * this.amplitude / 100);
            System.out.println("剑意增加" + this.amplitude + "%");
            return true;
        }
        return false;
    }
}

